package com.tomas.services;

import com.tomas.dao.UserDao;
import com.tomas.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserService {
    @Autowired
    private UserDao ur;

    public void testAdd(User um){ ur.save(um); }

   /* public static void main(String[] args) {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        UserService c = (UserService)ctx.getBean("userService");
        User um = new User();
        um.setId(1);
        um.setUsername("111");um.setPassword("123456");
        c.testAdd(um);

    }*/
}